package com.wangxin.utils;

import java.util.Random;

public class CreateVerifyCode {

	public static String getCode(Integer len){
		if(len==null) len = 6;
	    String sources = "0123456789"; // 加上一些字母，就可以生成pc站的验证码了  
	    Random rand = new Random();  
	    StringBuffer flag = new StringBuffer();  
	    for (int j = 0; j < len; j++)   
	    {  
	        flag.append(sources.charAt(rand.nextInt(9)) + "");  
	    }  
	    return flag.toString();  
	}
	
	public static String getCode(){
		return getCode(6);
	}
}
